home *** CD-ROM | disk | FTP | other *** search
- /* farealoc.c --- p. 134 */
- # include <stdio.h>
- # include <alloc.h>
- main()
- {
- int far *block1, *block2;
- if((block1 = farmalloc(1000L)) == NULL)
- {
- printf("Block1 allocation failed!\n");
- exit(1);
- }
- printf("First block of 1,000 bytes allocated at %Fp\n",block1);
- if((block2 = farmalloc(100L)) == NULL)
- {
- printf("Block2 allocation failed!\n");
- exit(1);
- }
- printf("Second block of 100 bytes allocated at %Fp\n",block2);
- if((block1 = farrealloc(block1, 80000L)) == NULL)
- {
- printf("Block1 allocation failed!\n");
- exit(1);
- }
- printf("Size of first block adjusted to 80,000 bytes at %Fp\n",
- block1);
- }